<template>
  <div class="app-container">
<el-form :inline="true" :model="workflowNotice" class="demo-form-inline">
<el-form-item label="标题">
  <el-input v-model="workflowNotice.title" placeholder="请输入标题"></el-input>
</el-form-item>
<el-form-item>
  <el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
</el-form>
    <el-table v-loading="loading" :data="bclassList">
      <el-table-column label="标题" align="center" prop="title" :show-overflow-tooltip="true">
        <template slot-scope="scope">
          <el-link type="primary" @click="dianj(scope.row)">{{scope.row.title}}</el-link>
        </template>
      </el-table-column>
      <el-table-column label="内容" align="center" prop="content" :show-overflow-tooltip="true" >
      </el-table-column>
      <el-table-column label="时间" align="center" prop="createTime" :show-overflow-tooltip="true">     
             <template slot-scope="scope">
          <span>{{parseTime(scope.row.createTime)}}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column label="是否已读" align="center" prop="status" :show-overflow-tooltip="true">
          <template slot-scope="scope">
              <span v-if="scope.row.status==0">是</span>
              <span v-if="scope.row.status==1">否</span>
          </template>
      </el-table-column> -->
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="workflowNotice.pageNum"
      :limit.sync="workflowNotice.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改参数配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="50%">
       <el-form ref="form" :model="xqList" label-width="100px">
          <el-row>
            <el-col :span="12">
                <el-form-item label="标题" prop="title">
                    <span>{{xqList.title}}</span>
                </el-form-item>
            </el-col>
                <el-col :span="12">
                <el-form-item label="发布时间" prop="modifyTime">
                    <span>{{parseTime(xqList.modifyTime)}}</span>
                </el-form-item>
            </el-col>
            
          </el-row>
          <el-form-item label="内容" prop="content">
            <span>{{xqList.content}}</span>
          </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="open=false">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { queryjob, deletejob, resumejob, pausejob,addjob} from "@/api/sysconfig/job";
import { findNoticePageList,findById } from "@/api/notice/schoolNotice";
export default {
  name: "BClass",
  data() {
    return {
      cxForm:{
        title:null,
      },
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      stuCount: 0,
      // 字典表格数据
      bclassList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 班主任
      userOptions: [],
      // 状态数据字典
      statusOptions: [],
      // 班级所属部门
      classDeptOptions: [],
      // 查询参数
      workflowNotice: {
        pageNum: 1,
        pageSize: 10

      },
      // 表单参数
      form: {
        sex: '1'
      },
      selectedList:[],
      isUpdate:false,
      xqList:{},
    };
  },
  created() {
    this.getList();
  },
  methods: {
    onSubmit(){
       this.loading = true;
      findNoticePageList(this.workflowNotice).then(res=>{
        console.log(res)
        this.bclassList = res.data.list;
          this.total=res.data.total;
          this.loading = false;
      })
    },
    /** 查询班级列表 */
    getList() {
      this.loading = true;
      console.log(this.workflowNotice)
      findNoticePageList(this.workflowNotice).then(response => {
          console.log(response)
          this.bclassList = response.data.list;
          this.total=response.data.total;
          this.loading = false;
        }
      );
    },
    dianj(row){
      console.log(row)
      this.open=true;
      this.xqList=JSON.parse(JSON.stringify(row));
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
          locationPid:0,
          locationName:null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.workflowNotice.pageNum = 1;
      if(this.workflowNotice.locationName){
          this.workflowNotice.locationPid=null
      }else{
          this.workflowNotice.locationPid=0
      }
      
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");

      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd(row) {
      this.reset();
      this.open = true;
      this.title = "添加空间位置";
      this.form.locationPid = Number(row.id)
      this.disabledInput=false;
      this.isUpdate = false
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },

   
  }
};
</script>
<style>
 .el-table .warning-row {
    background: oldlace;
  }
</style>